import {observable, toJS} from 'mobx';
import assign from 'object-assign';
import UserStroe from '../containers/user/store';
import lybyShijue from 'lyby/shijue';

export const createServerState = () => {
    let defaultState = {};
    return new Promise((resolve, reject) => {
        UserStroe.getCurrentLoginUser().then(data => {
            assign(defaultState, {
                loginUserStore: data
            });
            resolve(defaultState);
        }).catch(err => {
            resolve(defaultState);
        });
    })
};

export const createClientState = () => {
    lybyShijue.init(window.__INITIAL_STATE__);
    return observable(window.__INITIAL_STATE__);
};//mergeObservables(defaultState, window.__INITIAL_STATE__);

